package io.renren.modules.shop.service.impl;

import io.renren.modules.shop.entity.ProductIdEntity;
import io.renren.modules.shop.entity.ShoppingCarsEntity;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.shop.dao.CarDao;
import io.renren.modules.shop.entity.CarEntity;
import io.renren.modules.shop.service.CarService;

import javax.annotation.Resource;


@Service("carService")
public class CarServiceImpl extends ServiceImpl<CarDao, CarEntity> implements CarService {

    @Resource CarDao carDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CarEntity> page = this.page(
                new Query<CarEntity>().getPage(params),
                new QueryWrapper<CarEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<ShoppingCarsEntity> getShoppingCarts(Long id) {
        return carDao.getShoppingCarts(id);

    }

    @Override
    public ShoppingCarsEntity getShoppingCart(Long id, Long pid) {
        return carDao.getShoppingCart(id,pid);
    }

}
